<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Front extends AR_Controller {

//------------------------首页-----------------------------------------------------------------------	
	
	public function index()
	{
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=1 and deleted=0","*","order_num desc");
		//获取广告
		$this->load->model("Ad_Model");
		$ad_list = $this->Ad_Model->get_list_ad("type=1 and deleted=0","*","order_num desc");
		//获取优选项目 每类四个
		$this->load->model("Project_Model");
		$projectlist_sb = $this->Project_Model->get_list_ad("project_style =1 and is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,4);
		$projectlist_sm = $this->Project_Model->get_list_ad("project_style =2 and is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,4);
		$projectlist_jj = $this->Project_Model->get_list_ad("project_style =3 and is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,4);
		
		//最新项目(每小类12个)
		$projectlist_all_1 = $this->Project_Model->get_list_ad("project_style =1 and deleted=0","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_11 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=1","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_12 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=2","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_13 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=3","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_14 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=4","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_15 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=5","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_16 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=6","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_17 = $this->Project_Model->get_list_ad("project_style  =1  and deleted=0  and hang_ye=7","*"," project_style asc , modify_date desc ",0,12);
		
		$projectlist_all_2 = $this->Project_Model->get_list_ad("project_style =2 and deleted=0","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_21 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=1","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_22 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=2","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_23 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=3","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_24 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=4","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_25 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=5","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_26 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=6","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_27 = $this->Project_Model->get_list_ad("project_style  =2  and deleted=0  and hang_ye=7","*"," project_style asc , modify_date desc ",0,12);
		
		$projectlist_all_3 = $this->Project_Model->get_list_ad("project_style =3 and deleted=0","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_31 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=1","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_32 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=2","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_33 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=3","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_34 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=4","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_35 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=5","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_36 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=6","*"," project_style asc , modify_date desc ",0,12);
		$projectlist_all_37 = $this->Project_Model->get_list_ad("project_style  =3  and deleted=0  and hang_ye=7","*"," project_style asc , modify_date desc ",0,12);
		
		//获取最新的四个视频
		$this->load->model("Article_Model");
		$video_list = $this->Article_Model->get_list_ad("style=1 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,4);
		//获取理财咨询
		$rd_list = $this->Article_Model->get_list_ad("deleted=0","*"," modify_date desc ",0,15);
		$sm_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0","*"," modify_date desc ",0,15);
		$sb_list = $this->Article_Model->get_list_ad("project_style=2 and deleted=0","*"," modify_date desc ",0,15);
		$tm_list = $this->Article_Model->get_list_ad("project_style=3 and deleted=0","*"," modify_date desc ",0,15);
		//投资走向
		$tzxw_list = $this->Article_Model->get_list_ad("deleted=0 and type_id=1 ","*"," modify_date desc ",0,5);
		$tzzx_list = $this->Article_Model->get_list_ad("deleted=0 and type_id=2 ","*"," modify_date desc ",0,5);
		$tzbk_list = $this->Article_Model->get_list_ad("deleted=0 and type_id=3 ","*"," modify_date desc ",0,5);
		
        $ad_first=array();
        $ad_second=array();
        $ad_third=array();
        $ad_four=array();
        $ad_five=array();
        foreach ($ad_list as $k=>$v){
        	if($v['address']==1){
        		$ad_first=$v;
        	}
        	if($v['address']==2){
        		$ad_second=$v;
        	}
        	if($v['address']==3){
        		$ad_third[]=$v;
        	}
        	if($v['address']==4){
        		$ad_four[]=$v;
        	}
        	if($v['address']==5){
        		$ad_five=$v;
        	}
        }
		//获取优选项项目
		//获取最新项目
		//视频中心
		//理财资讯
		//文章管理
		$this->load->view('front/index',array(
				"gdad_list"=>$gdad_list,
				"ad_first"=>$ad_first,
				"ad_second"=>$ad_second,
				"ad_third"=>$ad_third,
				"ad_four"=>$ad_four,
				"ad_five"=>$ad_five,
				"projectlist_sb"=>$projectlist_sb,
				"projectlist_sm"=>$projectlist_sm,
				"projectlist_jj"=>$projectlist_jj,
				"projectlist_all_1"=>$projectlist_all_1,
				"projectlist_all_11"=>$projectlist_all_11,
				"projectlist_all_12"=>$projectlist_all_12,
				"projectlist_all_13"=>$projectlist_all_13,
				"projectlist_all_14"=>$projectlist_all_14,
				"projectlist_all_15"=>$projectlist_all_15,
				"projectlist_all_16"=>$projectlist_all_16,
				"projectlist_all_17"=>$projectlist_all_17,
				
				"projectlist_all_2"=>$projectlist_all_2,
				"projectlist_all_21"=>$projectlist_all_21,
				"projectlist_all_22"=>$projectlist_all_22,
				"projectlist_all_23"=>$projectlist_all_23,
				"projectlist_all_24"=>$projectlist_all_24,
				"projectlist_all_25"=>$projectlist_all_25,
				"projectlist_all_26"=>$projectlist_all_26,
				"projectlist_all_27"=>$projectlist_all_27,
				
				"projectlist_all_3"=>$projectlist_all_3,
				"projectlist_all_31"=>$projectlist_all_31,
				"projectlist_all_32"=>$projectlist_all_32,
				"projectlist_all_33"=>$projectlist_all_33,
				"projectlist_all_34"=>$projectlist_all_34,
				"projectlist_all_35"=>$projectlist_all_35,
				"projectlist_all_36"=>$projectlist_all_36,
				"projectlist_all_37"=>$projectlist_all_37,
				"video_list"=>$video_list,
				"rd_list"=>$rd_list,
				"sm_list"=>$sm_list,
				"sb_list"=>$sb_list,
				"tm_list"=>$tm_list,
				"tzxw_list"=>$tzxw_list,
				"tzzx_list"=>$tzzx_list,
				"tzbk_list"=>$tzbk_list,
				
		));
		
	}

//------------------------首页-----------------------------------------------------------------------
	
	public function three_new_board(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=2 and deleted=0","*","order_num desc");
		//项目攻略
		$this->load->model("Project_Model");
		$gv_project = $this->Project_Model->get_list_p("type=1 and style=1 and b.deleted=0","*","b.modify_date desc",0,6);
		//精选项目
		$jx_project = $this->Project_Model->get_list_p("type=1 and style=2 and b.deleted=0","*","b.modify_date desc",0,4);
		//开户
		$this->load->model("Openaccount_Model");
		$openaccount_list = $this->Openaccount_Model->get_list_ad("deleted=0 and project_style=1","*","modify_date desc",0,50);
		//获取新三板项目
		$xsbzq_project = $this->Project_Model->get_list_ad("project_style=1 and deleted=0","*","modify_date desc",0,10);
		//获取私募项目
		$smzq_project = $this->Project_Model->get_list_ad("project_style=2 and deleted=0","*","modify_date desc",0,10);
		//三板认知
		$this->load->model("Article_Model");
		$sbrz_list = $this->Article_Model->get_list_ad("type_id=4 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//行业机构
		$hyjg_list = $this->Article_Model->get_list_ad("type_id=5 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//项目分析
		$xmfx_list = $this->Article_Model->get_list_ad("type_id=6 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
				
		$this->load->view('front/three_new_board',array(
				"gdad_list"=>$gdad_list,
				"gv_project"=>$gv_project,
				"jx_project"=>$jx_project,
				"openaccount_list"=>$openaccount_list,
				"xsbzq_project"=>$xsbzq_project,
				"smzq_project"=>$smzq_project,
				"sbrz_list"=>$sbrz_list,
				"hyjg_list"=>$hyjg_list,
				"xmfx_list"=>$xmfx_list,
		));
	}
	
	
	
	public function si_mu(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=3 and deleted=0","*","order_num desc");
		//项目攻略
		$this->load->model("Project_Model");
		$gv_project = $this->Project_Model->get_list_p("b.type=2 and style=1 and b.deleted=0","*","b.modify_date desc",0,6);
		//精选项目
		$jx_project = $this->Project_Model->get_list_p("b.type=2 and style=2 and b.deleted=0","*","b.modify_date desc",0,4);
		//开户
		$this->load->model("Openaccount_Model");
		$openaccount_list = $this->Openaccount_Model->get_list_ad("deleted=0 and project_style=2","*","modify_date desc",0,50);
		//获取新三板项目
		$xsbzq_project = $this->Project_Model->get_list_ad("project_style=1 and deleted=0","*","modify_date desc",0,10);
		//获取私募项目
		$smzq_project = $this->Project_Model->get_list_ad("project_style=2 and deleted=0","*","modify_date desc",0,10);
		//三板认知
		$this->load->model("Article_Model");
		$sbrz_list = $this->Article_Model->get_list_ad("type_id=4 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//行业机构
		$hyjg_list = $this->Article_Model->get_list_ad("type_id=5 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//项目分析
		$xmfx_list = $this->Article_Model->get_list_ad("type_id=6 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
	
		$this->load->view('front/si_mu',array(
				"gdad_list"=>$gdad_list,
				"gv_project"=>$gv_project,
				"jx_project"=>$jx_project,
				"openaccount_list"=>$openaccount_list,
				"xsbzq_project"=>$xsbzq_project,
				"smzq_project"=>$smzq_project,
				"sbrz_list"=>$sbrz_list,
				"hyjg_list"=>$hyjg_list,
				"xmfx_list"=>$xmfx_list,
		));
	}
	
	
	public function tian_mu_rz(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=4 and deleted=0","*","order_num desc");
		//项目攻略
		$this->load->model("Project_Model");
		$gv_project = $this->Project_Model->get_list_p("b.type=3 and style=1 and b.deleted=0","*","b.modify_date desc",0,6);
		//精选项目
		$jx_project = $this->Project_Model->get_list_p("b.type=3 and style=2 and b.deleted=0","*","b.modify_date desc",0,4);
		//开户
		$this->load->model("Openaccount_Model");
		$openaccount_list = $this->Openaccount_Model->get_list_ad("deleted=0 and project_style=3","*","modify_date desc",0,50);
		//获取新三板项目
		$xsbzq_project = $this->Project_Model->get_list_ad("project_style=1 and deleted=0","*","modify_date desc",0,10);
		//获取天幕基金项目
		$tmjj_project = $this->Project_Model->get_list_ad("project_style=3 and deleted=0","*","modify_date desc",0,10);
		//三板认知
		$this->load->model("Article_Model");
		$sbrz_list = $this->Article_Model->get_list_ad("type_id=4 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//行业机构
		$hyjg_list = $this->Article_Model->get_list_ad("type_id=5 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//项目分析
		$xmfx_list = $this->Article_Model->get_list_ad("type_id=6 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
	
		$this->load->view('front/tian_mu_rz',array(
				"gdad_list"=>$gdad_list,
				"gv_project"=>$gv_project,
				"jx_project"=>$jx_project,
				"openaccount_list"=>$openaccount_list,
				"xsbzq_project"=>$xsbzq_project,
				"tmjj_project"=>$tmjj_project,
				"sbrz_list"=>$sbrz_list,
				"hyjg_list"=>$hyjg_list,
				"xmfx_list"=>$xmfx_list,
		));
	}
	
	public function tian_mu_gq(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=5 and deleted=0","*","order_num desc");
		//项目攻略
		$this->load->model("Project_Model");
		$gv_project = $this->Project_Model->get_list_p("b.type=3 and style=1 and b.deleted=0","*","b.modify_date desc",0,6);
		//精选项目
		$jx_project = $this->Project_Model->get_list_p("b.type=3 and style=2 and b.deleted=0","*","b.modify_date desc",0,4);
		//开户
		$this->load->model("Openaccount_Model");
		$openaccount_list = $this->Openaccount_Model->get_list_ad("deleted=0 and project_style=4","*","modify_date desc",0,50);
		//获取新三板项目
		$xsbzq_project = $this->Project_Model->get_list_ad("project_style=1 and deleted=0","*","modify_date desc",0,10);
		//获取天幕基金项目
		$tmjj_project = $this->Project_Model->get_list_ad("project_style=4 and deleted=0","*","modify_date desc",0,10);
		//三板认知
		$this->load->model("Article_Model");
		$sbrz_list = $this->Article_Model->get_list_ad("type_id=4 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//行业机构
		$hyjg_list = $this->Article_Model->get_list_ad("type_id=5 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
		//项目分析
		$xmfx_list = $this->Article_Model->get_list_ad("type_id=6 and deleted=0 and project_style=1 ","*"," modify_date desc ",0,5);
	
		$this->load->view('front/tian_mu_gq',array(
				"gdad_list"=>$gdad_list,
				"gv_project"=>$gv_project,
				"jx_project"=>$jx_project,
				"openaccount_list"=>$openaccount_list,
				"xsbzq_project"=>$xsbzq_project,
				"tmjj_project"=>$tmjj_project,
				"sbrz_list"=>$sbrz_list,
				"hyjg_list"=>$hyjg_list,
				"xmfx_list"=>$xmfx_list,
		));
	}
	
	
	
	public function video_center(){
		$this->load->model("Article_Model");
		$project_style = isset($_GET['project_style'])?$_GET['project_style']:1;
		$video_list = $this->Article_Model->get_list_ad("project_style=$project_style and style=1 and deleted=0","*"," order_num desc ",0,9);
		$tuijian_list = $this->Article_Model->get_list_ad("style=0 and tuijian_date is not null and deleted=0","*"," tuijian_date desc ",0,12);
		$rd_list = $this->Article_Model->get_list_ad("style=0 and deleted=0","*"," view_num desc ",0,12);
		$this->load->view('front/video_center',array("video_list"=>$video_list,"tuijian_list"=>$tuijian_list,"rd_list"=>$rd_list));
	}
	
	public function video_detail(){
		$this->load->model("Article_Model");
		$id = $_GET['id']?$_GET['id']:0;
		if(!$id){
			echo "无数据";
			exit(0);
		}
		$this->Article_Model->update_view_num("id=".$id);
		$article_info = $this->Article_Model->get_one("id=".$id);
		$tuijian_list = $this->Article_Model->get_list_ad("style=0 and tuijian_date is not null and deleted=0","*"," tuijian_date desc ",0,12);
		$rd_list = $this->Article_Model->get_list_ad("style=0 and deleted=0","*"," view_num desc ",0,12);
		$rem_video_list = $this->Article_Model->get_list_ad("style=1 and deleted=0 and id != ".$id,"*"," view_num desc ",0,3);
		$video_list = $this->Article_Model->get_list_ad("style=1 and deleted=0 and id != ".$id,"*"," create_date desc ",0,9);
		$this->load->view('front/video_detail',array("article_info"=>$article_info,"tuijian_list"=>$tuijian_list,"rd_list"=>$rd_list,"rem_video_list"=>$rem_video_list,"video_list"=>$video_list));
	}
	
	public function article_detail(){
		$this->load->model("Article_Model");
		$id = $_GET['id']?$_GET['id']:0;
		if(!$id){
			echo "无数据";
			exit(0);
		}
		$this->Article_Model->update_view_num("id=".$id);
		$article_info = $this->Article_Model->get_one("id=".$id);
		if(!$article_info){
			echo "无此文章";
			return;
		}
		$tuijian_list = $this->Article_Model->get_list_ad("style=0 and tuijian_date is not null and deleted=0","*"," tuijian_date desc ",0,12);
		$rd_list = $this->Article_Model->get_list_ad("style=0 and deleted=0","*"," view_num desc ",0,12);
		$rem_video_list = $this->Article_Model->get_list_ad("style=0 and deleted=0 and id != ".$id,"*"," view_num desc ",0,3);
		$video_list = $this->Article_Model->get_list_ad("style=0 and deleted=0 and id != ".$id,"*"," create_date desc ",0,9);
		//相关文章
		$xg_list = $this->Article_Model->get_list_ad("style=0 and project_style= ".$article_info['project_style']." and deleted=0 and id!=".$id,"*"," tuijian_date desc ",0,0);
		$is_collect=0;
		if(isset($_SESSION['member']) && $_SESSION['member']){
			$this->load->model("Collection_Model");
			$collect_info = $this->Collection_Model->get_one("deleted=0 and article_id=".$id." and member_id=".$_SESSION['member']['id']);
			if($collect_info){
				$is_collect=1;
			}
		}
		$this->load->view('/front/article_detail',array("is_collect"=>$is_collect,"article_info"=>$article_info,"tuijian_list"=>$tuijian_list,"rd_list"=>$rd_list,"rem_video_list"=>$rem_video_list,"video_list"=>$video_list,"xg_list"=>$xg_list));
	}
	
	public function university(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=7 and deleted=0","*","order_num desc");
		$gdad1_list = $this->Gdad_Model->get_list_ad("type=8 and deleted=0","*","order_num desc");
		
		//投资走向
		$this->load->model("Article_Model");
		$sbzx_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$smzx_list = $this->Article_Model->get_list_ad("project_style=2 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$jjbk_list = $this->Article_Model->get_list_ad("project_style=3 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		
		//三板头条
		$sntt_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and style=1","*"," modify_date desc ",0,10);
		
		//热点咨询
		$rdzx_list = $this->Article_Model->get_list_ad("deleted=0 and style=1","*"," modify_date desc ",0,9);
		
		//获取优选项目 每类四个
		$this->load->model("Project_Model");
		$projectlist_sb = $this->Project_Model->get_list_ad("is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,3);
		
		
		$this->load->view('front/university',array(
				"gdad_list"=>$gdad_list,
				"gdad1_list"=>$gdad1_list,
				"sbzx_list"=>$sbzx_list,
				"smzx_list"=>$smzx_list,
				"jjbk_list"=>$jjbk_list,
				"sntt_list"=>$sntt_list,
				"rdzx_list"=>$rdzx_list,
				"projectlist_sb"=>$projectlist_sb,
		));
	}
	
	public function financial_information(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=6 and deleted=0","*","order_num desc");
		
		//投资走向
		$this->load->model("Article_Model");
		$sbzx_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$smzx_list = $this->Article_Model->get_list_ad("project_style=2 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$jjbk_list = $this->Article_Model->get_list_ad("project_style=3 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		
		//三板头条
		$sntt_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and style=1","*"," modify_date desc ",0,10);
		
		//热点咨询
		$rdzx_list = $this->Article_Model->get_list_ad("deleted=0 and style=1","*"," modify_date desc ",0,9);
		
		//获取优选项目 每类四个
		$this->load->model("Project_Model");
		$projectlist_sb = $this->Project_Model->get_list_ad("is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,3);
		
		
		$this->load->view('front/financial_information',array(
				"gdad_list"=>$gdad_list,
				"sbzx_list"=>$sbzx_list,
				"smzx_list"=>$smzx_list,
				"jjbk_list"=>$jjbk_list,
				"sntt_list"=>$sntt_list,
				"rdzx_list"=>$rdzx_list,
				"projectlist_sb"=>$projectlist_sb,
		));
	}
	
	public function touzibaike(){
		//获取滚动图片
		$this->load->model("Gdad_Model");
		$gdad_list = $this->Gdad_Model->get_list_ad("type=7 and deleted=0","*","order_num desc");
		
		//投资走向
		$this->load->model("Article_Model");
		$sbzx_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$smzx_list = $this->Article_Model->get_list_ad("project_style=2 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		$jjbk_list = $this->Article_Model->get_list_ad("project_style=3 and deleted=0 and type_id=2 and style=0","*"," modify_date desc ",0,5);
		
		//三板头条
		$sntt_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0 and style=1","*"," modify_date desc ",0,10);
		
		//热点咨询
		$rdzx_list = $this->Article_Model->get_list_ad("deleted=0 and style=1","*"," modify_date desc ",0,9);
		
		//获取优选项目 每类四个
		$this->load->model("Project_Model");
		$projectlist_sb = $this->Project_Model->get_list_ad("is_youxuan = 1 and deleted=0","*"," modify_date desc ",0,3);
		
		
		$this->load->view('front/financial_information',array(
				"gdad_list"=>$gdad_list,
				"sbzx_list"=>$sbzx_list,
				"smzx_list"=>$smzx_list,
				"jjbk_list"=>$jjbk_list,
				"sntt_list"=>$sntt_list,
				"rdzx_list"=>$rdzx_list,
				"projectlist_sb"=>$projectlist_sb,
		));
	}
	
	public function project_detail(){
		$this->load->model("Project_Model");
		$id = $_GET['id']?$_GET['id']:0;

		$project_info = $this->Project_Model->get_one("id=".$id);
		$this->load->view('front/project_detail',array("project_info"=>$project_info));
	}
	
	public function about(){
		$this->load->view('front/about/index');
	}
	public function qiyewenhua(){
		$this->load->view('front/about/qiyewenhua');
	}
	
	public function mianzeshengm(){
		$this->load->view('front/about/mianzeshengm');
	}
	
	public function contract(){
		$this->load->view('front/about/contract');
	}
	public function anquanbaoz(){
		$this->load->view('front/about/anquanbaoz');
	}
	
	public function upload(){
		date_default_timezone_set("Asia/chongqing");
		error_reporting(E_ERROR);
		header("Content-Type: text/html; charset=utf-8");
		
		$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);
		$action = $_GET['action'];
		
		switch ($action) {
			case 'config':
				$result =  json_encode($CONFIG);
				break;
		
				/* 上传图片 */
			case 'uploadimage':
				/* 上传涂鸦 */
			case 'uploadscrawl':
				/* 上传视频 */
			case 'uploadvideo':
				/* 上传文件 */
			case 'uploadfile':
				$result = $this->aa();
				//$result = include("action_upload.php");
				break;
		
				/* 列出图片 */
			case 'listimage':
				$result = $this->load->library('action_list.php');
				//$result = include("action_list.php");
				break;
				/* 列出文件 */
			case 'listfile':
				$result = $this->load->library('action_list.php');
				//$result = include("action_list.php");
				break;
		
				/* 抓取远程文件 */
			case 'catchimage':
				$result = $this->load->library('action_crawler.php');
				//$result = include("action_crawler.php");
				break;
		
			default:
				$result = json_encode(array(
				'state'=> '请求地址出错'
						));
						break;
		}
		
		/* 输出结果 */
		if (isset($_GET["callback"])) {
			if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
				echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
			} else {
				echo json_encode(array(
						'state'=> 'callback参数不合法'
				));
			}
		} else {
			echo $result;
		}
	}
	
	public function aa(){
		$this->load->library('Uploader');
		/* 上传配置 */
		$base64 = "upload";
		switch (htmlspecialchars($_GET['action'])) {
			case 'uploadimage':
				$config = array(
				"pathFormat" => '/upload/{yyyy}{mm}{dd}/{time}{rand:6}',
				"maxSize" =>2048000,
				"allowFiles" => array(".png", ".jpg", ".jpeg", ".gif", ".bmp")
				);
				$fieldName = $CONFIG['upfile'];
				break;
			case 'uploadscrawl':
				$config = array(
				"pathFormat" => $CONFIG['scrawlPathFormat'],
				"maxSize" => $CONFIG['scrawlMaxSize'],
				"allowFiles" => $CONFIG['scrawlAllowFiles'],
				"oriName" => "scrawl.png"
						);
						$fieldName = $CONFIG['scrawlFieldName'];
						$base64 = "base64";
						break;
			case 'uploadvideo':
				$config = array(
				"pathFormat" => $CONFIG['videoPathFormat'],
				"maxSize" => $CONFIG['videoMaxSize'],
				"allowFiles" => $CONFIG['videoAllowFiles']
				);
				$fieldName = $CONFIG['videoFieldName'];
				break;
			case 'uploadfile':
			default:
				$config = array(
				"pathFormat" => $CONFIG['filePathFormat'],
				"maxSize" => $CONFIG['fileMaxSize'],
				"allowFiles" => $CONFIG['fileAllowFiles']
				);
				$fieldName = $CONFIG['fileFieldName'];
				break;
		}
		
		/* 生成上传实例对象并完成上传 */
		$up = new Uploader($fieldName, $config, $base64);
		
		/**
		 * 得到上传文件所对应的各个参数,数组结构
		 * array(
		 *     "state" => "",          //上传状态，上传成功时必须返回"SUCCESS"
		 *     "url" => "",            //返回的地址
		 *     "title" => "",          //新文件名
		 *     "original" => "",       //原始文件名
		 *     "type" => ""            //文件类型
		 *     "size" => "",           //文件大小
		 * )
		*/
		
		/* 返回数据 */
		return json_encode($up->getFileInfo());
		
	}
	
	public function particle_list(){
		//获取优选项目 每类四个
		$this->load->model("Article_Model");
		$articlelist_1 = $this->Article_Model->get_list_ad("project_style =1 and deleted=0","*"," modify_date desc ",0,6);
		$articlelist_2 = $this->Article_Model->get_list_ad("project_style =2 and deleted=0","*"," modify_date desc ",0,6);
		$articlelist_3 = $this->Article_Model->get_list_ad("project_style =3 and deleted=0","*"," modify_date desc ",0,6);
		$articlelist_4 = $this->Article_Model->get_list_ad("project_style =4 and deleted=0","*"," modify_date desc ",0,6);
		$articlelist_5 = $this->Article_Model->get_list_ad("project_style =5 and deleted=0","*"," modify_date desc ",0,6);
		$articlelist_6 = $this->Article_Model->get_list_ad("project_style =6 and deleted=0","*"," modify_date desc ",0,6);
		$sm_list = $this->Article_Model->get_list_ad("deleted=0","*"," modify_date desc ",0,12);
		$rd_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0","*"," view_num desc ",0,12);
		
		$this->load->view('front/particle_list',array(
				"articlelist_1"=>$articlelist_1,
				"articlelist_2"=>$articlelist_2,
				"articlelist_3"=>$articlelist_3,
				"articlelist_4"=>$articlelist_4,
				"articlelist_5"=>$articlelist_5,
				"articlelist_6"=>$articlelist_6,
				"rd_list"=>$rd_list,
				"sm_list"=>$sm_list,
		));
	}
	
	public function article_list(){
		$page = $_GET['page']?$_GET['page']:1;
		$project_style = $_GET['project_style']?$_GET['project_style']:1;
		$type_id =  isset($_GET['type_id'])?$_GET['type_id']:0;
		$this->load->model("Article_Model");
		$where="project_style =$project_style and deleted=0";
		if($type_id){
			$where=$where." and type_id=$type_id";
		}
		$articlelist = $this->Article_Model->get_list_ad($where,"*"," modify_date desc ",($page-1)*10,10);
		$total = $this->Article_Model->getTotal($where);
		$sm_list = $this->Article_Model->get_list_ad("deleted=0","*"," modify_date desc ",0,12);
		$rd_list = $this->Article_Model->get_list_ad("project_style=1 and deleted=0","*"," view_num desc ",0,12);
		
		$this->load->view('front/article_list',array(
				"articlelist"=>$articlelist,
				"rd_list"=>$rd_list,
				"sm_list"=>$sm_list,
				"page"=>$page,
				"project_style"=>$project_style,
				"page_size"=>ceil($total/20)
		));
	}
	
	/**
	 * 登录
	 */
	public function login(){
		$this->load->view('front/login');
	}
	
	/**
	 * 注册
	 */
	public function register(){
		$this->load->view('front/register');
	}
	
	public function login_post(){
		$this->load->helper('cookie');
		$name = $_POST['name']?$_POST['name']:'';
		$pass = $_POST['pass']?$_POST['pass']:'';
		$this->load->model("Member_Model");
		$member = $this->Member_Model->get_one("(name='".$name."' or mobile='".$name."') and password='".md5($pass)."'");
		if($member){
			$_SESSION['member']=$member;
			echo json_encode(array("success"=>1,"msg"=>"登录成功"));
			exit(0);
		}else{
			echo json_encode(array("success"=>0,"msg"=>"账号或密码错误"));
			exit(0);
		}
	}
	
	public function login_out(){
		$this->load->helper('cookie');
		$_SESSION['member']='';
		$this->index();
	}
	
	/**
	 * 
	 */
	public function register_post(){
		
		//$name = $_POST['name']?$_POST['name']:'';
		$pass = $_POST['pass']?$_POST['pass']:'';
		$mobile = $_POST['mobile']?$_POST['mobile']:'';
		$code = $_POST['code']?$_POST['code']:'';
		if(!$mobile){
			echo json_encode(array("success"=>0,"msg"=>"手机号码不能为空"));
			exit(0);
		}
		/* if(!$name){
			echo json_encode(array("success"=>0,"msg"=>"账号不能为空"));
			exit(0);
		} */
		if(!$pass){
			echo json_encode(array("success"=>0,"msg"=>"密码不能为空"));
			exit(0);
		}
		if(!$code){
			echo json_encode(array("success"=>0,"msg"=>"验证码不能为空"));
			exit(0);
		}
		$this->load->model("Verifycode_Model");
		$num = $this->Verifycode_Model->getTotal("mobile='".$mobile."' and code='".$code."' and create_date>= now()-interval 5 minute");
		if($num<0){
			echo json_encode(array("success"=>0,"msg"=>"验证码错误或已失效"));
			exit(0);
		}
		$data = array(
				"mobile"=>$mobile,
				"password"=>md5($pass),
				'create_date'=>date('Y-m-d H:i:s'),
				'modify_date'=>date('Y-m-d H:i:s'),
		);
		$this->load->model("Member_Model");
		$num = $this->Member_Model->getTotal("mobile='".$mobile."'");
		if($num){
			echo json_encode(array("success"=>0,"msg"=>"已经注册过了，不用再注册"));
			exit(0);
		}
		$id = $this->Member_Model->add($data);
		if($id){
			echo json_encode(array("success"=>1,"msg"=>"注册成功"));
			exit(0);
		}else{
			echo json_encode(array("success"=>0,"msg"=>"注册失败"));
			exit(0);
		}
	}
	
	public function lostpass_post(){
	
		$pass = $_POST['pass']?$_POST['pass']:'';
		$mobile = $_POST['mobile']?$_POST['mobile']:'';
		$code = $_POST['code']?$_POST['code']:'';
		if(!$mobile){
			echo json_encode(array("success"=>0,"msg"=>"手机号码不能为空"));
			exit(0);
		}
		if(!$pass){
			echo json_encode(array("success"=>0,"msg"=>"密码不能为空"));
			exit(0);
		}
		if(!$code){
			echo json_encode(array("success"=>0,"msg"=>"验证码不能为空"));
			exit(0);
		}
		$this->load->model("Verifycode_Model");
		$num = $this->Verifycode_Model->getTotal("mobile='".$mobile."' and code='".$code."' and create_date>= now()-interval 5 minute");
		if($num<0){
			echo json_encode(array("success"=>0,"msg"=>"验证码错误或已失效"));
			exit(0);
		}
		$data = array(
				"mobile"=>$mobile,
				"password"=>md5($pass),
				'modify_date'=>date('Y-m-d H:i:s'),
		);
		$this->load->model("Member_Model");
		$id = $this->Member_Model->update($data,"mobile='".$mobile."'");
		if($id){
			echo json_encode(array("success"=>1,"msg"=>"注册成功"));
			exit(0);
		}else{
			echo json_encode(array("success"=>0,"msg"=>"注册失败"));
			exit(0);
		}
	}
	
	/**
	 * 忘记密码
	 */
	public function lost_pass(){
		$this->load->view('front/lost_pass');
	}
	
	public function get_verify_code(){
		$mobile = $_POST['mobile']?$_POST['mobile']:'';
		$is_register = $_POST['is_register']?$_POST['is_register']:'';
		 
		if(!$mobile){
			echo json_encode(array("success"=>0,"msg"=>"手机号码不能为空"));
			exit(0);
		}
		if($is_register){
			//注册，先判断该手机号码是否已经注册
			$this->load->model("Member_Model");
			$num = $this->Member_Model->getTotal("mobile='".$mobile."'");
			if($num>0){
				echo json_encode(array("success"=>0,"msg"=>"该手机号码是否已经注册,请不要重复注册"));
				exit(0);
			}
		}
		$this->load->model("Verifycode_Model");
		$num = $this->Verifycode_Model->getTotal("mobile='".$mobile."' and create_date>= now()-interval 5 minute");
		if($num>0){
			echo json_encode(array("success"=>0,"msg"=>"请不要重复请求验证码"));
			exit(0);
		}
		$num = $this->Verifycode_Model->getTotal("mobile='".$mobile."' and DATE_FORMAT(create_date,'%Y-%m-%d')>= '".date('"Y-m-d ')."'");
		if($num>=10){
			echo json_encode(array("success"=>0,"msg"=>"一天内请求短信过多"));
			exit(0);
		}
		$code=rand(1000, 9999);
		$data = array("code"=>$code,"mobile"=>$mobile,"create_date"=>date('Y-m-d H:i:s'));
		$id = $this->Verifycode_Model->add($data);
		if($id){
			include '/application/libraries/alidayu/TopSdk.php';
			$c = new TopClient();
			$c -> appkey = "23659058";
			$c -> secretKey = "b298222db912a95600b0ac3735a151b8";
			$req = new AlibabaAliqinFcSmsNumSendRequest();
			$req -> setExtend("");
			$req -> setSmsType("normal");
			$req -> setSmsFreeSignName("大鱼测试");
			$req -> setSmsParam("{code:'" . "$code" . "',product:'荆门劳动检查'}");
			$req -> setRecNum($mobile);
			$req -> setSmsTemplateCode("SMS_49295302");
			$resp = $c -> execute($req);
			echo json_encode(array("success"=>1,"msg"=>"请求验证码成功"));
			exit(0);
		}else{
			echo json_encode(array("success"=>0,"msg"=>"请求验证码失败"));
			exit(0);
		}
	}
	
	public function ng(){
		$this->load->view('front/ng');
	}
}
